
import matplotlib.pyplot as plt


plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False


months=['01','02','03','04','05','06','07','08','09','10','11','12']
max_temps = [29, 30, 31, 32, 33, 34, 31, 30, 29, 30, 32, 33]
min_temps = [22, 23, 24, 25, 24, 25, 24, 23, 22, 23, 24, 25]
plt.figure(figsize=(16,4),dpi=150)
plt.grid(linestyle=':',alpha=0.5)
plt.xlabel("月份")
plt.ylabel("温度(单位：C)")
plt.title("清远市未来12天的最低温和最高温")
plt.plot(months,max_temps,color="r",label="平均最高温度",marker='o')
plt.plot(months,min_temps,color="b",label="平均最低温度",marker='o')
plt.legend()
plt.show()
plt.savefig("temp.png")
